<?php
class App_Form_LoginForm extends Zend_Form
{
    public function init()
    {
       $request = new Zend_Controller_Request_Http();
        $this->setMethod('post');
        $this->setName('logForm');
        $this->setAction('');

        
        $this->addElement('text', 'input_login', array(
		'filters' => array('StringTrim', 'StringToLower'),
		'label' => 'Login',
		'required'   => true,
		'class' =>'inputlog',
		'filters' => array('StripTags','StringTrim'),
		'maxLength' => 15,
		'invalidMessage' => 'błędny login',
		'validators' => array(
                             array('StringLength', false, array(4,15,'messages' => array(
                             Zend_Validate_StringLength::TOO_SHORT => 'za krótkie',
                             Zend_Validate_StringLength::TOO_LONG => 'za długie',
                           )))
           )
         ));

        $this->addElement('password', 'input_password', array(
		'filters' => array('StringTrim'),
		'label' =>'hasło',
		'required' => true,
		'class' =>'inputlog',
		'maxLength' => 16,
		'invalidMessage' => 'błędne hasło',
		'validators' => array(
                               array('StringLength', false, array(8,16,'messages' => array(
                             Zend_Validate_StringLength::TOO_SHORT => 'za krótkie',
                             Zend_Validate_StringLength::TOO_LONG => 'za długie',
                           )))
           )
         ));

        $this->addElement('button', 'input_zaloguj', array(
            'label'    => 'zaloguj',
	    'class'=>'form_btn',
            'type' => 'submit'
        ));

        $viewScript = new Zend_Form_Decorator_ViewScript();
        $viewScript->setViewScript('form/login.phtml');
        $this->clearDecorators();
        $this->addDecorator($viewScript);

    }
}
?>
